
#include "SDL2/SDL.h"

int main(int argc, char* argv[])
{

	SDL_Init(SDL_INIT_EVERYTHING);
	SDL_Window* window = SDL_CreateWindow("SDL", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 1280, 720, SDL_WINDOW_ALLOW_HIGHDPI | SDL_WINDOW_RESIZABLE);
	SDL_Renderer* renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED);
	while (true) {
		SDL_Event sdl_event;
		if (SDL_PollEvent(&sdl_event) && sdl_event.type == SDL_QUIT) break;
		SDL_SetRenderDrawColor(renderer, 255, 0, 0, 255);
		SDL_RenderClear(renderer);
		SDL_RenderPresent(renderer);
		SDL_Delay(30);
	}
	SDL_Quit();
	return 0;
}


//#include "SDL2/SDL.h"
//#include "cairo/cairo.h"
//
//// __imp_GradientFill
//#pragma comment(lib, "MSIMG32.LIB ") 
//int main(int argc, char* argv[])
//{
//    Uint32 rmask, gmask, bmask, amask;
//
//#if SDL_BYTEORDER == SDL_BIG_ENDIAN
//    rmask = 0xff000000;
//    gmask = 0x00ff0000;
//    bmask = 0x0000ff00;
//    amask = 0x000000ff;
//#else
//    rmask = 0x000000ff;
//    gmask = 0x0000ff00;
//    bmask = 0x00ff0000;
//    amask = 0xff000000;
//#endif
//	SDL_Surface* m_sdl_surface = SDL_CreateRGBSurface(0, 1280, 720, 32, rmask, gmask, bmask, amask);
//	cairo_surface_t* surface = cairo_image_surface_create_for_data((unsigned char*)m_sdl_surface->pixels, CAIRO_FORMAT_ARGB32, 1280, 720, m_sdl_surface->pitch);
//    cairo_t* m_cr = cairo_create(surface);
//	SDL_Window* m_sdl_window = SDL_CreateWindow("SDL", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 1280, 720, SDL_WINDOW_ALLOW_HIGHDPI | SDL_WINDOW_RESIZABLE);
//
//    while (true) {
//		SDL_Event sdl_event;
//		if (SDL_PollEvent(&sdl_event) && sdl_event.type == SDL_QUIT) break;
//
//		static SDL_Rect s_rect = { 0, 0, 0, 0 };
//		cairo_rectangle(m_cr, 0, 0, 1280, 720);
//		cairo_set_source_rgba(m_cr, 1, 1, 1, 1);
//		cairo_fill(m_cr);
//		//cairo_select_font_face(m_cr, "Sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
//		cairo_set_source_rgba(m_cr, 1, 0, 1, 1);
//		cairo_set_font_size(m_cr, 90.0);
//		cairo_move_to(m_cr, 400, 400);
//		cairo_show_text(m_cr, "Hello");
//		cairo_surface_flush(cairo_get_target(m_cr));
//		//m_paint->Flush();
//		s_rect.x = 0;
//		s_rect.y = 0;
//		s_rect.w = 1280;
//		s_rect.h = 720;
//		SDL_Surface* window_surface = SDL_GetWindowSurface(m_sdl_window);
//		SDL_BlitSurface(m_sdl_surface, &s_rect, window_surface, &s_rect);
//		SDL_UpdateWindowSurface(m_sdl_window);
//        SDL_Delay(30);
//    }
//	return 0;
//}